package com.csw.mysqldate.exception;

/**
 * 自定义异常
 * 抛异常的时候一定要用throw new BusinessException("XXX"); 不能return  new BusinessException("XXX");
 *
 * @Transactional(rollbackFor = Throwable.class)
 */
public class BusinessException extends RuntimeException {
    private int errorCode;

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(int errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }

    public BusinessException(int errorCode, String message, Throwable cause) {
        super(message, cause);
        this.errorCode = errorCode;
    }

    public int getErrorCode() {
        return errorCode;
    }
}
